﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.TxtNowTime.Text = DateTime.Now.ToString();
        this.TxtNewTime.Text = DateTime.Now.AddSeconds(30).ToString();
    }
    protected void BtnOk_Click(object sender, EventArgs e)
    {
        
        DateTime dateTime1 = DateTime.Parse(DateTime.Now.AddSeconds(30).ToString());
        DateTime dateTime2 = DateTime.Parse(DateTime.Now.ToString());
        //使用TimeSpan对象获取时间间隔
        TimeSpan timeSpan = dateTime1 - dateTime2;
        TxtInterval.Text = timeSpan.ToString();
    }
}
